package com.dingup.homework.service;

import com.dingup.homework.bean.DO.HwHomeworkDO;
import com.dingup.homework.bean.DO.HwHomeworkRecordDO;
import com.dingup.homework.bean.DTO.HomeworkProgressDTO;
import com.dingup.homework.bean.DTO.HomeworkRecordDODataMapInfo;

import java.util.HashMap;
import java.util.List;

/**
 * @author jun 2018/11/13.
 */
public interface HwHomeworkRecordsService {
    /**
     * add
     *
     * @param hwHomeworkRecord HwHomeworkRecordDO
     * @return Boolean
     */
    Boolean add(HwHomeworkRecordDO hwHomeworkRecord) throws Exception;

    /**
     * update
     *
     * @param hwHomeworkRecord HwHomeworkRecordDO
     * @return Boolean
     */
    Boolean update(HwHomeworkRecordDO hwHomeworkRecord);

    HomeworkRecordDODataMapInfo getById(Integer id);

    List<HomeworkRecordDODataMapInfo> listByStudentId(String userId);

    List<HomeworkRecordDODataMapInfo> listByUserIds(HashMap<String, Object> param);

    /**
     * 检查是否存在某条记录
     *
     * @param homeworkId Integer
     * @param studentId  String
     * @return Boolean
     */
    Boolean exist(Integer homeworkId, String studentId);

    /**
     * 通过homeworkId获取全部学生记录数据
     *
     * @param homeworkId Integer
     * @return
     */
    List<HomeworkRecordDODataMapInfo> listByHomeworkId(Integer homeworkId);

    /**
     * User: jun
     * Date: 2017/12/15
     * Desc: 获取符合推送单次作业报告的数据
     */
    List<HwHomeworkRecordDO> getList4WeekReport();

    List<HwHomeworkRecordDO> getHomeworkSortResult(Integer homeworkId);

    HwHomeworkRecordDO getByHomeworkAndStudent(Integer homeworkId, String studentId);

    Boolean updateHomeworkValid(Integer id, Integer ifValidForStudent, Integer ifValidForTeacher);

    List<HwHomeworkRecordDO> getByCreateTeacherId(String teacherId);

    /**
     * 添加作业记录
     *
     * @param hwHomework HwHomeworkDO
     * @throws Exception Exception
     */
    void addHomeworkRecord(HwHomeworkDO hwHomework) throws Exception;

    /**
     * 获取作业进度
     *
     * @param homeworkId Integer
     * @return List<HomeworkProgressDTO>
     */
    List<HomeworkProgressDTO> listProgress(Integer homeworkId);

    /**
     * 保存作业进度
     *
     * @param homeworkRecordId Integer
     * @param questionNum      Integer
     * @param id               Integer
     * @param examId           String
     * @param correct          Integer
     * @param total            Integer
     */
    void saveHomeworkProgress(Integer homeworkRecordId, Integer questionNum, Integer id, String examId,
                              Integer correct, Integer total);

    /**
     * 根据 homeworkRecordId 获取 HomeworkId
     *
     * @param homeworkRecordId Integer
     * @return Integer
     */
    Integer getHomeworkIdByHomeworkRecordId(Integer homeworkRecordId);
}
